/**
 * License model
 */
package data.converter.model;

import java.io.IOException;
import java.io.Writer;
import java.util.LinkedHashMap;

import org.json.simple.JSONStreamAware;
import org.json.simple.JSONValue;

public class License extends Product implements JSONStreamAware{

	private double fee;
	private double annualCost;
	
	public License(){}
	
	public License(Product product) {
		super.setName(product.getName());
		super.setProductCode(product.getProductCode());
		super.setType(product.getType());
	}
	
	public double getFee() {
		return fee;
	}
	
	public void setFee(double fee) {
		this.fee = fee;
	}
	
	public double getAnnualCost() {
		return annualCost;
	}
	
	public void setAnnualCost(double annualCost) {
		this.annualCost = annualCost;
	}
	
	public void writeJSONString(Writer out){
		LinkedHashMap obj = new LinkedHashMap();
		obj.put("fee", fee);
		obj.put("annualCost", annualCost);
		obj.put("productCode", getProductCode());
		obj.put("name", getName());
		try {
			JSONValue.writeJSONString(obj, out);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
